package gui;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Paint;

import javax.swing.JPanel;

import convertor.Convert;

import play.score;

import tag.constants;

@SuppressWarnings("serial")
public class title extends JPanel implements constants{

	Paint _bg = new Color(0,0,0,150);
	
	
	public title(){
		setOpaque(false);
		setPreferredSize(new Dimension(frame_width,20));
	}
	
	public void paintChildren(Graphics g){
		 FontMetrics metrics = g.getFontMetrics();
		 
		String purple_string = "purple : "+score.purple;
		String gold_string = "gold : "+score.gold;
		String score_string = "score : "+(score.purple*points_per_purple+score.gold*points_per_gold);
		String time_string = "time wasted : "+Convert.toTime(score.time*speed);
		
		Graphics2D g2 = (Graphics2D)g;
		g2.setPaint(_bg);
		g2.fillRect(0,0,getWidth(),getHeight());
		
		g2.setPaint(_bg);
		g2.drawString(purple_string, 7,16);
		g2.setPaint(Color.white);
		g2.drawString(purple_string, 7,15);
		
		
		g2.setPaint(_bg);
		g2.drawString(gold_string, metrics.stringWidth(purple_string)+27,16);
		g2.setPaint(Color.white);
		g2.drawString(gold_string, metrics.stringWidth(purple_string)+27,15);
		
		g2.setPaint(_bg);
		g2.drawString(score_string, metrics.stringWidth(purple_string)+metrics.stringWidth(gold_string)+54,16);
		g2.setPaint(Color.white);
		g2.drawString(score_string, metrics.stringWidth(purple_string)+metrics.stringWidth(gold_string)+54,15);
		
		
		g2.setPaint(_bg);
		g2.drawString(time_string, 500,16);
		g2.setPaint(Color.white);
		g2.drawString(time_string, 500,15);
	}
}
